﻿package mortal.game.view.monthInvestment.view
{
    import Message.DB.Tables.*;
    import com.mui.controls.*;
    import fl.data.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.view.common.*;

    public class MonthInvestMainPanel extends GSprite
    {
        private var _investList:GTileList;

        public function MonthInvestMainPanel()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.MonthInvestTitle, 28, -125, this));
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.MonthInvestBg, 28, 10, this));
            this._investList = UIFactory.tileList(32, 15, 700, 420, this);
            this._investList.rowHeight = 400;
            this._investList.columnWidth = 169;
            this._investList.setStyle("cellRenderer", monthInvestTypeCellRender);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._investList.dispose(param1);
            this._investList = null;
            super.disposeImpl(param1);
            return;
        }// end function

        public function updateInvestState() : void
        {
            this._investList.dataProvider = this.getDateProvider();
            return;
        }// end function

        private function getDateProvider() : DataProvider
        {
            var _loc_4:TInvestBase = null;
            var _loc_7:Object = null;
            var _loc_1:* = new DataProvider();
            var _loc_2:* = MonthInvestmentConfig.instance.rewardArr;
            var _loc_3:* = _loc_2.length;
            var _loc_5:* = Cache.instance.role.entityInfo.level;
            var _loc_6:int = 1;
            while (_loc_6 < _loc_3)
            {
                
                _loc_4 = MonthInvestmentConfig.instance.getInvestBaseByType(_loc_6);
                if (_loc_4 && _loc_5 >= _loc_4.level)
                {
                    _loc_7 = {type:_loc_6};
                    _loc_1.addItem(_loc_7);
                }
                _loc_6++;
            }
            return _loc_1;
        }// end function

    }
}
